package com.situ.edu.service.impl;

import com.situ.edu.dao.IStudentCouDao;
import com.situ.edu.dao.impl.StudentCouDaoImpl;
import com.situ.edu.pojo.entity.Elective;
import com.situ.edu.pojo.entity.Student;
import com.situ.edu.pojo.query.CourseQuery;
import com.situ.edu.pojo.vo.CourseVO;
import com.situ.edu.service.IStudentCouService;
import com.situ.edu.util.PageInfo;

import java.util.List;

public class StudentCouServiceImpl implements IStudentCouService {
    private IStudentCouDao studentCouDao = new StudentCouDaoImpl();
    @Override
    public PageInfo selectByPage(CourseQuery courseQuery) {
        List<CourseVO> list = studentCouDao.selectByPage(courseQuery);
        int totalCount = studentCouDao.selectTotalCount(courseQuery);

        return PageInfo.ok(totalCount,list);
    }

    @Override
    public void add(Elective elective) {
        studentCouDao.add(elective);
    }



    @Override
    public List<Student> selectAll() {
        return studentCouDao.selectAll();
    }

    @Override
    public void update(Elective elective) {
        studentCouDao.update(elective);
    }

    @Override
    public Student selectById(int id) {
        return studentCouDao.selectById(id);
    }

    /*@Override
    public Student selectById(String name) {
        return studentCouDao.selectById(name);
    }*/

    @Override
    public void updateStu(Student student) {
        studentCouDao.updateStu(student);
    }

    @Override
    public void addElective(int id, int courseId) {
        studentCouDao.addElective(id,courseId);
    }
}
